package ${package}.utils;

import com.ishansong.common.json.Jsoner;
import com.ishansong.zk.core.ZkClient;

/**
 * Created by sid on 17/8/2.
 *
 * @author sid
 */
public class VirtualMobileZkClient {

    private static final ZkClient zkClient = ZkClient.newClient(ZkUtil.getZkCluster(), "virtualMobile");

    public static ZkClient get() {
        return zkClient;
    }

    public static void setData(String path, String data) {
        try {
            zkClient.client().setData().forPath(path, data.getBytes("UTF-8"));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static void setJson(String path, Object obj) {
        setData(path, Jsoner.DEFAULT.toJson(obj));
    }

}
